package com.example.mybatisdemo.controller;

import com.example.mybatisdemo.model.UserInfo;
import com.example.mybatisdemo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.PrimitiveIterator;

/**
 * @author : niu niu
 * @version : 1.0.0
 * @date : 2023/4/23 16:27
 */
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService ;
    @RequestMapping("/getuserbyid")
    public UserInfo getUserById(Integer id){
        if (id==null ) return  null;
        return userService.getUserById(id);
    }

    @RequestMapping("/getall")
    public List<UserInfo> getAll(){
        return userService.getAll();
    }
}
